package leetcode.秋招.腾讯;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author ：zsy
 * @date ：Created 2021/9/5 19:57
 * @description：
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] A = new int[n];
        int[] B = new int[n];
        for (int i = 0; i < A.length; i++) {
            int num = in.nextInt();
            A[i] = divide(num);
        }
        for (int i = 0; i < B.length; i++) {
            int num = in.nextInt();
            B[i] = divide(num);
        }
        Arrays.sort(A);
        Arrays.sort(B);
        int res = 0;
        int index = 0;
        for (int i = 0; i < A.length; i++) {
            if (A[i] > B[index]) {
                res++;
                index++;
            }
        }
        System.out.println(res);
    }

    private static int divide(int n) {
        int res = 1;
        for (int i = 2; i <= n / i; i++) {
            if (n % i == 0) {
                int cnt = 1;
                while (n % i == 0) {
                    cnt++;
                    n /= i;
                }
                res *= cnt;
            }
        }
        if (n > 1) res *= 2;
        return res;
    }
}
